package mapreduce;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class ReduceDiskManager<KEYOUT, VALUEOUT> extends DiskManager<KEYOUT, VALUEOUT>{
	public ReduceDiskManager(String jobdir, long buffersize, int taskid) throws IOException
	{
		super(jobdir);
		File reducedir= new File(jobdir+"reduce/output/");
		if(!reducedir.exists())
			reducedir.mkdirs();
		bw = new BufferedWriter(new FileWriter(jobdir+"reduce/output/"+taskid+".data", true));
	}
	public void write(KEYOUT key , VALUEOUT value)
    {
		try {
			bw.write(key+"\t"+value);
			bw.newLine();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
			
		
    }

}
